# Maintainer: David Runge <dvzrv@archlinux.org>

_name=humanfriendly
pkgname=python-humanfriendly
pkgver=10.0
pkgrel=5
pkgdesc="Human friendly input/output for text interfaces using Python"
arch=(any)
url="https://github.com/xolox/python-humanfriendly"
license=(MIT)
depends=(python)
makedepends=(
  python-build
  python-installer
  python-setuptools
  python-wheel
)
# ticket for the removal of mock: https://github.com/xolox/python-humanfriendly/issues/62
checkdepends=(
  python-docutils
  python-mock
  python-pytest
)
source=(https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz)
sha512sums=('496700bcea1dabf003c938558bf807fabb41b71192f69622979dd9e243dda9b4b06c5ac8f65cef217df85ebadf99099dc22b50d63216791a569be11081d267d6')
b2sums=('6db7f2f11bafcdc087c078eae6123046610594b17899678e445baa18c25b2210cc1d84363d858ab7c57fce6d6b7a189be69dea08c1891d3f5b11ff9900c9bef9')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

# tests are completely broken and this project is dead... -_-
# check() {
#   cd $_name-$pkgver
#   # disable tests that require dusty capturer project
#   pytest -v $_name/tests.py -k "not test_terminal_capabilities and not test_generate_warning and not test_prompt_for_confirmation"
# }

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 {CHANGELOG,README}.rst -t "$pkgdir/usr/share/doc/$pkgname/"
  install -vDm 644 LICENSE.txt -t "$pkgdir/usr/share/licenses/$pkgname/"
}
